<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<script>
    function add() {
        if (typeof arguments[0] == "number" && typeof arguments[1] == "number") {
            return arguments[0] + arguments[1];
        }
        else if (arguments.length == 1 && typeof arguments[0] == "number") {
            var x = arguments[0];
            //如果只有一个数字型参数x，返回x和后面捕捉到的任意一个数字型参数y之和
            return function (y) {
                if (typeof y == "number") {
                    return x + y;
                }
            };
        }
    }

    add(2, 3);
</script>
</body>
</html>